<?php
 include 'conn.php';
$id = $_POST['id'];
$name = $_POST['name'];
$sex = $_POST['sex'];
$age = $_POST['age'];
$edu = $_POST['edu'];
$salary = $_POST['salary'];
$bonus = $_POST['bonus'];
$city = $_POST['city'];

$sql = "UPDATE `student` 
			SET 
				`name`= ?, 
				`sex`= ?, 
				`age`= ?, 
				`edu`= ?, 
				`salary`= ?, 
				`bonus`= ?, 
				`city`= ? 
			WHERE `id`= ?";
$stmt = mysqli_prepare($link,$sql);
mysqli_stmt_bind_param($stmt,"ssssssss",$name,$sex,$age,$edu,$salary,$bonus,$city,$id);
if ($name){
   $result =  mysqli_stmt_execute($stmt);
   if ($result){
       header("Location:index.php");
   }else{
       exit('修改学生信息sql语句执行失败。错误信息：' . mysqli_error($link));
   }
}else{
    //修改学生失败
    //输出提示，跳转到首页
    echo "修改学生失败！<br><br>";
    header('Refresh: 3; url=index.php');  //3s后跳转
}

?>
